#include "widget.h"
#include <QPushButton>
#include <QString>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    this->c_student = new Student;
    this->c_teacher = new Teacher;

//    this->class_is_over();

    QPushButton *btn_xiake = new QPushButton("下课", this);
//    btn_xiake->setText("下课");
//    btn_xiake->setParent(this);
    this->resize(600,400);

    void(Teacher::*pf_teacher_hungry)(void) = &Teacher::hungry;
    void(Student::*pf_student_treat)(void) = &Student::treat;
    connect(c_teacher, pf_teacher_hungry, c_student, pf_student_treat);
    connect(btn_xiake, &QPushButton::clicked, c_teacher, pf_teacher_hungry);
}
void Widget::class_is_over()
{
    emit c_teacher->hungry("老八小汉堡");
}

Widget::~Widget()
{

}
